package com.lkei.controller;

import com.lkei.dto.Result;
import com.lkei.entity.Department;
import com.lkei.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 周贵有
 * @date 2021/3/27
 */
@RestController
@RequestMapping("department")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    @CrossOrigin
    @RequestMapping("findAll")
    public Result findAll(){
        List<Department> departments = departmentService.findAll();
        return Result.SUCCESS.setNewData(departments);
    }
}
